import React, { Component } from 'react'

export default class App extends Component {
  render() {
    let person={
        name:'Person',
        show(age,sex){
            return `我叫${this.name},我今年${age}岁,我的性别是${sex}`
        }
    }
    let softEnginee={
        name:'软件工程师'
    }
    let javaTeacher={
        name:'Java培训讲师'
    }
    //直接调用自己
    console.log(person.show(120,"男")); 
    //使用call来借用,实际上改变this的指向
    console.log(person.show.call(softEnginee,26,"女"));
    console.log(person.show.apply(javaTeacher,[35,"男"]));
    console.log('***********************************');
    //使用bind来改变this
    const newShow=person.show.bind(softEnginee)
    console.log(newShow(67,"女"));
    return (
      <div>App</div>
    )
  }
}
